﻿@*@model IEnumerable<SDE_FIC.Models.Turma>*@
@model PagedList.IPagedList<SDE_FIC.Models.Turma>
@using SDE_FIC.Models;
@using PagedList.Mvc
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
@{
    ViewBag.Title = "Matricula";
    Layout = "~/Views/Shared/_Layout_Sistema.cshtml";
}

<h2>@ViewBag.Title</h2>

@*<p>
    @Html.ActionLink("Nova Turma", "Create")
</p>*@

<table class="table table-bordered table-hover">
    <thead>
    <tr>
        <th>
            Descrição
        </th>
        <th>
            Professor
        </th>
        <th>
            Total de Alunos
        </th>
        <th>
            Status
        </th>
        @*<th>
            Ter
        </th>
        <th>
            Qua
        </th>
        <th>
            Qui
        </th>
        <th>
            Sex
        </th>
        <th>
            Sab
        </th>
        <th>
            Dom
        </th>*@
        <th>Ação</th>
    </tr>

    </thead>
@foreach (var item in Model) {
    <tbody>
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Descricao) - @Html.DisplayFor(modelItem => item.Curso.CursoNome)<br />
            <font size="1,5">
            <b>Horário: </b> @Html.DisplayFor(modelItem => item.Horario) - <b>Início:</b> @Html.DisplayFor(modelItem => item.DataInicio) - 
            <b>Término:</b> @Html.DisplayFor(modelItem => item.DataFim)</font>
        </td>
        <td style="text-align:center;">
            @Html.DisplayFor(modelItem => item.Funcionario.NomeCompleto)
        </td>

        <td style="text-align:center;">
            @*@Html.CheckBoxFor(modelItem => item.Segunda, new { @disabled = true })*@          
            @{int TotalMatriculas = 0;}
            @foreach (var item2 in (List<Matricula>)ViewBag.lMatricula){
                if (item2.Turma.Idturma == item.Idturma) {
                    TotalMatriculas = TotalMatriculas + 1;
                }
            }
            @TotalMatriculas
        </td>
        <td style="text-align:center;">
             @Html.CheckBoxFor(modelItem => item.Status, new { @disabled = true })
        </td>
        @*<td style="text-align:center;">
            @Html.CheckBoxFor(modelItem => item.Terca, new { @disabled = true })
        </td>
        <td style="text-align:center;">
             @Html.CheckBoxFor(modelItem => item.Quarta, new { @disabled = true })
        </td>
        <td style="text-align:center;">
             @Html.CheckBoxFor(modelItem => item.Quinta, new { @disabled = true })
        </td>
        <td style="text-align:center;">
             @Html.CheckBoxFor(modelItem => item.Sexta, new { @disabled = true })
        </td>
        <td style="text-align:center;">
             @Html.CheckBoxFor(modelItem => item.Sabado, new { @disabled = true })
        </td>
        <td style="text-align:center;">
             @Html.CheckBoxFor(modelItem => item.Domingo, new { @disabled = true })
        </td>*@
   
        <td style="text-align:center;">
            <a href="@Url.Action("Matricular", "Matricula", new { id = item.Idturma })"><img src="~/Content/img/editar.png" alt="Editar"/></a>
           @* <a href="@Url.Action("Matriculas", "Matricula", new { id = item.Idturma })"><img src="~/Content/img/detalhes.png" alt="Detalhes"/></a>*@
            @*<a href="@Url.Action("Delete", "Turma", new { id = item.Idturma })"><img src="~/Content/img/excluir.png" alt="Excluir"/></a>*@

            </td>

    </tr>
   </tbody>
}

</table>
<div style="font-size: 8pt; width: 100%; text-align: right;">
    @Html.PagedListPager(Model, page => Url.Action("Index", new { pagina = page }))
</div>
